import LoginView from "@/views/LoginView/LoginView.vue";

const routes = [
  {
    path: "/",
    redirect: "/login",
    meta: {
      isPublic: true,
      isPublicAuth: true,
    },
  },
  {
    path: "/login",
    name: "login",
    component: LoginView,
    meta: {
      isPublic: true,
      isPublicAuth: true,
    },
  },
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/HomeView/HomeView.vue"),
    children: [
      {
        path: "welcome",
        name: "welcome",
        component: () => import("@/views/WelcomeView/WelcomeView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "欢迎页",
            },
          ],
        },
      },
      {
        path: "users",
        name: "users",
        component: () => import("@/views/UserView/UserView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "用户管理",
            },
            {
              sub: "用户列表",
            },
          ],
        },
      },
      {
        path: "roles",
        name: "roles",
        component: () => import("@/views/RoleView/RoleView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "权限管理",
            },
            {
              sub: "角色列表",
            },
          ],
        },
      },
      {
        path: "rights",
        name: "rights",
        component: () => import("@/views/RightView/RightView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "权限管理",
            },
            {
              sub: "权限列表",
            },
          ],
        },
      },
      {
        path: "goods",
        name: "goods",
        component: () => import("@/views/GoodsView/GoodsView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "商品管理",
            },
            {
              sub: "商品列表",
            },
          ],
        },
      },
      {
        path: "goods/add",
        name: "goodAdd",
        component: () => import("@/views/GoodsView/GoodsEditView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "商品管理",
            },
            {
              sub: "商品列表",
              path: "/home/goods",
            },
            {
              sub: "商品添加",
            },
          ],
        },
      },
      {
        path: "goods/update/:gid",
        name: "goodUpate",
        component: () => import("@/views/GoodsView/GoodsEditView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "商品管理",
            },
            {
              sub: "商品列表",
              path: "/home/goods",
            },
            {
              sub: "商品更新",
            },
          ],
        },
      },
      {
        path: "params",
        name: "params",
        component: () => import("@/views/ParamsView/ParamsView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "商品管理",
            },
            {
              sub: "商品参数",
            },
          ],
        },
      },
      {
        path: "categories",
        name: "categories",
        component: () => import("@/views/CategoryView/CategoryView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "商品管理",
            },
            {
              sub: "商品分类",
            },
          ],
        },
      },
      {
        path: "orders",
        name: "orders",
        component: () => import("@/views/OrderView/OrderView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "订单管理",
            },
            {
              sub: "订单列表",
            },
          ],
        },
      },
      {
        path: "auth",
        name: "auth",
        component: () => import("@/views/NoAuthView/NoAuthView.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "未授权",
            },
          ],
          isPublicAuth: true,
        },
      },
      {
        path: ":arg(.*)*",
        component: () => import("@/views/NotFound/NotFound.vue"),
        meta: {
          breadcrumb: [
            {
              sub: "资源不存在",
            },
          ],
          isPublicAuth: true,
        },
      },
    ],
  },
  {
    path: "/:arg(.*)*",
    redirect: "/login",
    meta: {
      isPublic: true,
      isPublicAuth: true,
    },
  },
];

export default routes;
